﻿// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. 
// See License.txt in the project root for license information.

using System.Threading.Actors.Languages;
using System.Threading.Tasks;

namespace System.Threading.Actors
{
    public interface IActor
    {
        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is object
        Task<string> CallMethod(string clientId, int clientSequenceNumber, string partitionName, string methodName, string[] parameters);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is bool
        Task<string> AddAssembly(int clientSequenceNumber, string partitionName, string assemblyName, byte[] assemblyBytes);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is null
        string Subscribe(int clientSequenceNumber, string partitionName, string eventType, IPublicationCallbackContract context);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is null
        string Unsubscribe(int clientSequenceNumber, string partitionName, string eventType, IPublicationCallbackContract context);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is null
        string UnsubscribeAll(int clientSequenceNumber, string partitionName, IPublicationCallbackContract context);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is the service's address
        // (e.g., "fabric:/actor/list/mylist") in string form.
        string Ping(int clientSequenceNumber, string partitionName);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is null
        // Tweaks parameters for running the actor, such as ETW event verbosity.
        // Configuration string format: Foo=x;Bar=y
        string Configure(int clientSequenceNumber, string partitionName, string configurationString);

        Task<string> AddMethod(int clientSequenceNumber, string partitionName, int language, string methodName, string methodImpl);

        // Returns an ActorServiceResult encoded as a JSON string, ASR.Result is bool.
        string DeleteSelf(int clientSequenceNumber, string partitionName);
    }

    public interface IPublicationCallbackContract
    {
        void OnNewEvent(ActorEvent actorEvent);
        void OnCompleting();
    }


}
